package com.order.mapper;

import com.github.pagehelper.Page;
import com.order.annotation.AutoFill;
import com.order.dto.ProductPageQueryDTO;
import com.order.entity.Product;
import com.order.enumeration.OperationType;
import com.order.vo.ProductVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper {

    @Select("select id, name, current_price, description, image from product where id = #{id}")
    ProductVo getById(Long id);

    Page<Product> pageQuery(ProductPageQueryDTO pageQueryDTO);

    @AutoFill(value = OperationType.INSERT)
    void insert(Product product);

    @Select("select * from product where id = #{id}")
    Product getById1(Long id);

    void deleteByIds(List<Long> ids);
    @AutoFill(value = OperationType.UPDATE)
    void update(Product product);

}
